<?php
	include_once '../../../../../core/configuration.php';
	include_once '../../../../../core/root_models/db.class.php';
	
	$objectDB = new DB("imagenesxinmueble");
	
	$id = $_POST['id'];
	$sql = mysql_query("SELECT url FROM imagenesxinmueble WHERE id = ".$id);
	while($row = mysql_fetch_array($sql)) {
		$imagen = $row['url'];
	}
	
	$img = explode("website/",$imagen);
	unlink("../../../../../../".$img[1]."-960x315.jpg");
	unlink("../../../../../../".$img[1]."-208x160.jpg");
	unlink("../../../../../../".$img[1]."-380x294.jpg");
	unlink("../../../../../../".$img[1]."-92x71.jpg");
	$query = "DELETE FROM imagenesxinmueble WHERE id = ".$id;
	mysql_query($query);
	
	echo "Borrado!";
?>